home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Programming / EnterAct 3.5 / Drag_on Modules / hAWK example progs / $CcommentsToAWK < prev    next >
Encoding:
Text File  |  1994-01-26  |  358 b   |  27 lines  |  [TEXT/KEEN]

  1. #$CcommentsToAWK: convert simple C comments to # comments
  2. #Only one comment can start or end on a line
  3.  
  4.      { 
  5.      if ($0 ~ /^\/\*/)
  6.          {
  7.         if ($0 ~ /\*\//) #one line comment
  8.             {
  9.             sub(/^\/\*/, "")
  10.             sub(/\*\//, "")
  11.             print "# " $0
  12.             }
  13.         else
  14.             {
  15.             getline
  16.             do
  17.                 {
  18.                 print "#" $0
  19.                 getline
  20.                 } while ($0 !~ /^\*\//);
  21.             }
  22.         }
  23.     else
  24.         print
  25.      }
  26.  
  27.